#include "cpu/exec/template-start.h"

#if DATA_BYTE == 2 || DATA_BYTE == 4
make_helper(concat(cltd_, SUFFIX)) {
	REG(R_EDX) = -(MSB(REG(R_EAX)));		//将R_EAX符号位扩展到R_EDX

	print_asm("cltd" str(SUFFIX));
	return 1;
}
//执行cwtl指令的helper函数
make_helper(concat(cwtl_, SUFFIX)) {
#if DATA_BYTE == 2
	reg_w(R_AX) = (int8_t)reg_b(R_AL);		//将R_AL的8位有符号只扩展到R_AX
#else
	reg_l(R_EAX) = (int16_t)reg_w(R_AX);	//将R_AX的16位有符号值扩展到R_EAX
#endif

	print_asm("cwtl" str(SUFFIX));
	return 1;
}
#endif

#include "cpu/exec/template-end.h"
